#!/bin/bash

clear
echo "请先安装好 zabbix-agent !!"
sleep 4
yum install https://www.percona.com/downloads/percona-monitoring-plugins/1.1.6/percona-zabbix-templates-1.1.6-1.noarch.rpm -y
cp /var/lib/zabbix/percona/templates/userparameter_percona_mysql.conf /etc/zabbix/zabbix_agentd.d/


cd /var/lib/zabbix/percona/scripts/

rm -rf *

wget https://gitee.com/zzhlinux911218/software/raw/master/ss_get_mysql_stats.php   --no-check-certificate
wget https://gitee.com/zzhlinux911218/software/raw/master/get_mysql_stats_wrapper.sh --no-check-certificate

chmod +x get_mysql_stats_wrapper.sh ss_get_mysql_stats.php

clear
/var/lib/zabbix/percona/scripts/get_mysql_stats_wrapper.sh gg
sleep 3

clear
sh /var/lib/zabbix/percona/scripts/get_mysql_stats_wrapper.sh running-slave
sleep 3

systemctl restart zabbix-agent
